package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Window.Type;
import net.miginfocom.swing.MigLayout;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class CreateAccountGui extends JFrame {

	private JPanel contentPane;
	private JTextField firstNameField;
	private JTextField lastNameField;
	private JTextField addressField;
	private JTextField phoneNrField;
	private JTextField salaryField;
	private JTextField usernameField;
	private JPasswordField passwordField;
	private JPasswordField passwordField_1;
	private JTextField emailField;
	private JTextField cprField;
	/**
	 * Create the frame.
	 */
	public CreateAccountGui() {
		setAlwaysOnTop(true);
		setTitle("Create Account");
		setType(Type.UTILITY);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 422);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[][grow]", "[][][][][][][][][][][][][][][][][]"));
		
		JLabel lblCreateAccount = new JLabel("Create Account");
		contentPane.add(lblCreateAccount, "cell 0 0 2 1,alignx center");
		
		JSeparator separator = new JSeparator();
		contentPane.add(separator, "cell 0 1 2 1,growx");
		
		JLabel lblName = new JLabel("First Name:");
		contentPane.add(lblName, "cell 0 2,alignx trailing");
		
		firstNameField = new JTextField();
		contentPane.add(firstNameField, "cell 1 2,growx");
		firstNameField.setColumns(10);
		
		JLabel lblLastName = new JLabel("Last Name:");
		contentPane.add(lblLastName, "cell 0 3,alignx trailing");
		
		lastNameField = new JTextField();
		contentPane.add(lastNameField, "cell 1 3,growx");
		lastNameField.setColumns(10);
		
		JLabel lblCpr = new JLabel("CPR:");
		contentPane.add(lblCpr, "cell 0 4,alignx trailing");
		
		cprField = new JTextField();
		contentPane.add(cprField, "cell 1 4,growx");
		cprField.setColumns(10);
		
		JLabel lblAddress = new JLabel("Address:");
		contentPane.add(lblAddress, "cell 0 5,alignx trailing");
		
		addressField = new JTextField();
		contentPane.add(addressField, "cell 1 5,growx");
		addressField.setColumns(10);
		
		JLabel lblPhoneNr = new JLabel("Phone nr.:");
		contentPane.add(lblPhoneNr, "cell 0 6,alignx trailing");
		
		phoneNrField = new JTextField();
		contentPane.add(phoneNrField, "cell 1 6,growx");
		phoneNrField.setColumns(10);
		
		JLabel lblEmail = new JLabel("Email:");
		contentPane.add(lblEmail, "cell 0 7,alignx trailing");
		
		emailField = new JTextField();
		contentPane.add(emailField, "cell 1 7,growx");
		emailField.setColumns(10);
		
		JLabel lblSalary = new JLabel("Salary:");
		contentPane.add(lblSalary, "cell 0 8,alignx trailing");
		
		salaryField = new JTextField();
		contentPane.add(salaryField, "cell 1 8,growx");
		salaryField.setColumns(10);
		
		JLabel lblPosition = new JLabel("Position:");
		contentPane.add(lblPosition, "cell 0 9,alignx trailing");
		
		JComboBox positionField = new JComboBox();
		positionField.setModel(new DefaultComboBoxModel(new String[] {"Salesman", "Intern", "Manager", "Admin"}));
		contentPane.add(positionField, "cell 1 9,growx");
		
		JSeparator separator_1 = new JSeparator();
		contentPane.add(separator_1, "cell 0 11 2 1,growx");
		
		JLabel lblUsername = new JLabel("Username:");
		contentPane.add(lblUsername, "cell 0 12,alignx trailing");
		
		usernameField = new JTextField();
		contentPane.add(usernameField, "cell 1 12,growx");
		usernameField.setColumns(10);
		
		JLabel lblPassword = new JLabel("Password:");
		contentPane.add(lblPassword, "cell 0 13,alignx trailing");
		
		passwordField = new JPasswordField();
		contentPane.add(passwordField, "cell 1 13,growx");
		
		JLabel lblRepeatPassword = new JLabel("Repeat Password:");
		contentPane.add(lblRepeatPassword, "cell 0 14,alignx trailing");
		
		passwordField_1 = new JPasswordField();
		contentPane.add(passwordField_1, "cell 1 14,growx");
		
		JSeparator separator_2 = new JSeparator();
		contentPane.add(separator_2, "cell 0 15 2 1,growx");
		
		JButton btnCreate = new JButton("Create");
		contentPane.add(btnCreate, "cell 0 16,alignx right");
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		contentPane.add(btnCancel, "cell 1 16,aligny baseline");
	}

}
